function caesar() {

    var secretKey, expressWords, secretWords;
    expressWords = document.getElementById("expressId").value;
    secretKey = document.getElementById("secretKeyId").value;
    //这里记得把拿到的密钥值从字符串类型转为Number类型
    secretKeyNum = Number(secretKey);

    var start1 = "A".charCodeAt(0);
    var end1 = "Z".charCodeAt(0);
    var start2 = "a".charCodeAt(0);
    var end2 = "z".charCodeAt(0);

    var strList = expressWords.split("");
    var judge, replace;
    for (var i = 0; i < expressWords.length; i++) {
        judge = strList[i].charCodeAt(0);
        if (judge <= end1 && judge >= start1) {
            replace = start1 + (judge - start1 + secretKeyNum) % 26;
            strList[i] = String.fromCharCode(replace);
        }
        else if (judge <= end2 && judge >= start2) {
            replace = start2 + (judge - start2 + secretKeyNum) % 26;
            strList[i] = String.fromCharCode(replace);
        }
    }
    secretWords = strList.join("");
    document.getElementById('secretId').value = secretWords
}
